
            var rating = document.getElementsByClassName('rating')[0]
            var icon = document.getElementsByClassName('icon')
            var iconList = []
            for (var i = 0; i < icon.length; i++) {
                iconList.push(icon[i])
            }
            // 没有点过
            var flag = true
            document.addEventListener('click', function (event) {
                var target = event.target
                if (target.nodeName === 'I') {
                    var num = iconList.indexOf(target)
                    if (flag) {
                        for (var j = 0; j <= num; j++) {
                            icon[j].className += " active"
                        }
                        flag = false
                    } else {
                        // 判断加还是取消
                        if (icon[num].className.indexOf(' active') === -1) {
                            // 没有找到,则添加
                            for (var m = num; m >= 0; m--) {
                                if (icon[m].className.indexOf(' active') === -1) {
                                    icon[m].className += " active"
                                }
                            }
                        } else {
                            // 否则,进行删星星
                            for (var i = num; i <= icon.length; i++) {
                                icon[i].className = icon[i].className.replace(' active', '')
                            }
                        }
                    }
                }
            })
        